<template>
  <yt-page title="企业列表">
    <yt-group :group="false" :searchApi="searchApi" ref="group">
      <yt-card slot-scope="item" :title="item.EnterpriseName" btn="查看更多内容" @btn-click="goDetailPage(item.id)" :tag="false">
        <p class="text-info">
          <span>企业类型:</span>
          <span class="m-r">{{item.EconomyType}}</span>
          <span>经营范围:</span>
          <span class="m-r">{{item.BusinessScope}}</span>
          <span>地址:</span>
          <span>{{item.LocationAddressDetails}}</span>
        </p>
      </yt-card>
    </yt-group>
  </yt-page>
</template>

<script>
import { commonApi } from '@/common/api/commonApi.js'
import { ReplaceDictionary } from '@/common/utils'

export default {
  data() {
    return {
      input: false,
      inputValue: '',
      searchApi: async ({ skip, limit }) => {
        let p = [
          commonApi.dictionary('enterprise_type'),
          commonApi.search('ent_enterprise_register', {
            equalTo: { IsAuditing: false }
          })
        ]
        let [dic, items] = await Promise.all(p)
        return ReplaceDictionary(items, { EconomyType: dic })
      }
    }
  },
  methods: {
    goDetailPage(id) {
      this.$router.$push({
        path: '/company/register/detail',
        query: { id: id }
      })
    },
    refresh() {
      this.$refs.group.startPull()
    }
  }
}
</script>

<style scoped lang="stylus">
text-nowrap(line)
  display -webkit-box
  -webkit-box-orient vertical
  -webkit-line-clamp line
  overflow hidden

>>> .text-info
  color #aaa
  font-size 15px
  line-height 30px
  padding-left 10px
  padding-right 10px
  text-nowrap(2)
</style>
